﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AFounder.Client.Common
{
    public class TextBoxStreamWriter : TextWriter
    {
        private TextBox output = null;
        private TraceSource traceSource;
        private TraceSource allTraceSource;

        public TextBoxStreamWriter(TextBox output)
        {
            this.output = output;
        }

        public override Encoding Encoding
        {
            get { return System.Text.Encoding.UTF8; }
        }

        public override void WriteLine(string value)
        {
            base.WriteLine(value);
        }

        public override void Write(char value)
        {
            base.Write(value);
            this.output.BeginInvoke(new Action(() => { this.output.AppendText(value.ToString()); }));
        }
    } 
}
